package com.zkzx.common.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author young Email:yanghui@zkraising.com
 * @description 分页数据对象
 * @company 北京中科智兴物联科技有限公司 @版权所有
 * @since 2021年04月28日 18时08分
 */
@Data
@ApiModel(value = "分页数据对象", description = "需要的固定格式的分页数据")
public class PageResult<T extends Serializable> implements Serializable {
	private static final long serialVersionUID = -298782540975824948L;

	public PageResult() {
    }

    public PageResult(int page, int perPage, List<T> result, int totalNum) {
        this.page = page;
        this.perPage = perPage;
        this.result = result;
        this.totalNum = totalNum;
    }
    /**
     * 当前页码
     */
    @ApiModelProperty( value = "当前页码",
            notes = "version1:当前页码")
    private int page;

    /**
     * 每页条数
     */
    @ApiModelProperty( value = "每页条数",
            notes = "version1:每页条数")
    @JsonProperty(value = "per_page")
    private int perPage;

    /**
     * 需要展示的数据集合
     */
    @ApiModelProperty( value = "需要展示的数据集合",
            notes = "version1:需要展示的数据集合")
    private List<T> result ;

    /**
     *总条数
     */
    @ApiModelProperty( value = "总条数",
            notes = "version1:总条数")
    @JsonProperty(value = "total_num")
    private int totalNum;


}
